<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增用户')" />
    <script type="text/javascript">

        function submitHandler() {
            if ($.validate.form()) {
                add();
            }
        }

        function add() {
            $("input[id='state']").val($("input[id='state']").is(':checked')==true ? 1 : 0);
            $("input[id='isValid']").val($("input[id='isValid']").is(':checked')==true ? 1 : 0);
            $.ajax({
                cache : true,
                type : "POST",
                url : ctx + "admin/user/save",
                data : $("#form-user-add").serialize(),
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.successCallback(data);
                }
            });
        }
    </script>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-user-add" th:object="${user}">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="abbrName" id="abbrName" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户职务：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="objName" id="objName" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户别称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="aliasName" id="aliasName" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">内网邮箱：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="useremail" id="useremail" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">上级单位：</label>
            <div class="col-sm-8">
                <input class="form-control" readonly type="text" name="superId" id="superId" th:field="*{superId}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户状态：</label>
            <div class="col-sm-8">
                <label class="toggle-switch switch-solid">
                    <input type="checkbox" id="state" name="state" checked>
                    <span></span>
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否显示：</label>
            <div class="col-sm-8">
                <label class="toggle-switch switch-solid">
                    <input type="checkbox" id="isValid" name="isValid" checked>
                    <span></span>
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户级别：</label>
            <div class="col-sm-8">
                <select name="rankId" class="form-control m-b">
                    <option value="0">部级</option>
                    <option value="1">司级</option>
                    <option value="2">处级</option>
                    <option value="3">科级</option>
                    <option value="4">未定级</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">显示顺序：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="displayOrder" id="displayOrder" required>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
</body>
</html>
